﻿using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.Services;
using IntelligentAgriculture.WebAPI.Application.Command.ParturitionCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.ParturitionCommandHandler
{
    public class ParturitionDeleteCommandHandler : IRequestHandler<ParturitionDeleteCommand, int>
    {
        private readonly IParturitionService _parturitionService;
        public ParturitionDeleteCommandHandler(IParturitionService parturitionService)
        {
            _parturitionService = parturitionService;
        }
        public async Task<int> Handle(ParturitionDeleteCommand request, CancellationToken cancellationToken)
        {
            var entity = await _parturitionService.DeleParturition(request.Eartag);
            return entity;
        }
    }
}
